#

| Chapter 8 How the Shell Interprets What You Type |

## 8.3 Introduction to tcsh

Article 8.2 introduces bash and talks about shells that came before it. A lot of shell users prefer tcsh. It's like the C shell, but tcsh has added plenty of useful features and also fixed some notorious C shell bugs (47.2). In fact, tcsh is so much like csh (except for those ugly bugs) that when we say "the C shell" or csh in this book, we're also talking about tcsh.

In general, tcsh has a lot of the same features as bash. So I won't repeat the list from article 8.2. Instead, here are a few differences (from the point of view of a casual tcsh user like me, that is).

- My favorite tcsh feature confirms a command like the one below. I meant to type `rm *.c`:

  >     % rm * .c
  >     Do you really want to delete all files? [n/y] n

  In my opinion, tcsh keeps a better watch over the command line than bash does.

- My dyslexic fingers also like the automatic command name correction. In the next example, I type `srot`. Instead of saying `Command not found`, tcsh asks if I meant `sort`:

  >     % who | srot +3n +4

  >     CORRECT>who | sort +3n +4 (y|n|e|a)? y
  >     kim            pts/0        Jul 27 14:40  (rock.ny.ora.com)
  >     jpeek          pts/1        Jul 28 08:09  (jpeek.com)
  >         ...

- Like csh, tcsh has arrays (47.5). I find these really useful, both interactively and in shell programs. (bash won't have them until version 2.0.)

- On the downside, the shell variables - including prompts, and their setting - seem less flexible in tcsh. For example, resetting the prompt (except nice built-ins like `%c2`, which gives the last two parts of the current directory path) requires setting aliases.

tcsh | If you've used csh before, and you type more than a few commands a day on UNIX, check out tcsh. It's on the CD-ROM.

- JP

8.2 Introduction to bash |  | 8.4 Command Evaluation and Accidentally Overwriting Files